#include "city.h"
#include <cstring>
#include <iostream>
using namespace std;
const int INF = 0x3f3f3f3f;

City::City()
{
    this->citynum = 7;
    this->roadnum = 42;
    //城市具体信息表
    this->city[0]={"济南","jinan",0,100,100};
    this->city[1]={"北京","beijing",1,80,110};
    this->city[2]={"上海","shanghai",2,110,130};
    this->city[3]={"厦门","xiamen",3,130,105};
    this->city[4]={"辽宁","liaoning",4,60,135};
    this->city[5]={"新疆","xinjiang",5,70,75};
    this->city[6]={"成都","chengdu",6,125,80};

    //map 映射表
    this->getId["jinan"]=0;
    this->getId["beijing"]=1;
    this->getId["shanghai"]=2;
    this->getId["xiamen"]=3;
    this->getId["liaoning"]=4;
    this->getId["xinjiang"]=5;
    this->getId["chengdu"]=6;

    //道路信息
    //dis是距离的邻接矩阵
    //sp是道路通行距离除以速度的邻接矩阵
    memset(dis,INF,sizeof dis);
    dis[0][0]=0;dis[1][1]=0;dis[2][2]=0;dis[3][3]=0;dis[4][4]=0;dis[5][5]=0;dis[6][6]=0;
    dis[0][1]=200; dis[1][0]=200;
    dis[0][2]=500; dis[2][0]=500;
    dis[0][3]=1300;dis[3][0]=1300;
    dis[0][4]=1270;dis[4][0]=1270;
    dis[0][5]=1800;dis[5][0]=1800;
    dis[0][6]=900;dis[6][0]=900;
    dis[1][2]=1000;dis[2][1]=1000;
    dis[1][3]=750;dis[3][1]=750;
    dis[1][4]=860;dis[4][1]=860;
    dis[1][5]=950;dis[5][1]=950;
    dis[1][6]=600;dis[6][1]=600;
    dis[2][3]=900;dis[3][2]=900;
    dis[2][4]=1200;dis[4][2]=1200;
    dis[2][5]=1300;dis[5][2]=1300;
    dis[2][6]=950;dis[6][2]=950;
    dis[3][4]=2000;dis[4][3]=2000;
    dis[3][5]=1850;dis[5][3]=1850;
    dis[3][6]=1250;dis[6][3]=1250;
    dis[4][5]=1500;dis[5][4]=1500;
    dis[4][6]=1350;dis[6][4]=1350;
    dis[5][6]=1650;dis[6][5]=1650;
    for(int i=0;i<citynum;i++){
        for(int j=0;j<citynum;j++){
            spc[i][j]=dis[i][j]*1.0/60;
        }
    }
    for(int i=0;i<citynum;i++){
        for(int j=0;j<citynum;j++){
            spt[i][j]=dis[i][j]*1.0/180;
        }
    }
    spc[0][2]=dis[0][2]*1.0/25;//说明从0到2有拥堵
    spc[3][4]=dis[3][4]*1.0/26;
    spc[1][4]=dis[1][4]*1.0/30;
    spc[2][3]=dis[2][3]*1.0/25;




}
